package com.jp.knowledge.http;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.wifi.WifiManager;
import android.os.Environment;
import android.telephony.TelephonyManager;
import android.text.TextUtils;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.JsonParser;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import com.google.gson.JsonSyntaxException;
import com.ihsanbal.logging.Level;
import com.ihsanbal.logging.LoggingInterceptor;
import com.jp.knowledge.BuildConfig;
import com.jp.knowledge.model.IModel;
import com.jp.knowledge.util.JsonUtil;
import com.jp.knowledge.util.L;
import com.jp.knowledge.util.ResultSubscriber;
import com.jp.knowledge.util.SharedUtil;
import com.jp.knowledge.util.SignVerifyUtil;
import com.jp.knowledge.util.UrlManager;

import java.lang.reflect.Type;
import java.util.Map;
import java.util.TreeMap;
import java.util.concurrent.TimeUnit;

import okhttp3.OkHttpClient;
import okhttp3.internal.platform.Platform;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
import rx.Observable;
import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Action1;
import rx.functions.Func1;
import rx.schedulers.Schedulers;

/**
 * Created by jiayen on 16/9/28.
 */
public class HttpHelper {
	/**
	 * 这一部分配置常量，可以抽取出常量类
	 */
	private final String TOKEN_FILED = "token";
	private static final String BASE_PATH = UrlManager.HOST;//访问的地址
	private static final long DEFAULT_TIMEOUT = 1000 * 30;//默认超时时间(毫秒)

	private Retrofit mRetrofit;
	private NetInterface mNetService;
	public static String token = null;//token
	public static String uuid = null;//token
	private static HttpHelper instance;

	private static Context mContext;
//    private static String localNetMsgPath;

	public static final boolean EXTERNAL_RELEASE = BuildConfig.ENVIRONMENT;

	public static HttpHelper getInstance(Context context) {
		if (instance == null) {
			instance = new HttpHelper(context);
////            try {
////                localNetMsgPath = context.getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS) + "/netMsgLog.log";
////            } catch (Exception e){
//                localNetMsgPath = context.getCacheDir() + "/netMsgLog.log";
////            }
		}
		return instance;
	}

	private HttpHelper(Context context) {
		this.mContext = context;
		token = SharedUtil.getInstance(mContext).getToken();
		uuid = SharedUtil.getInstance(mContext).getUuid();
		OkHttpClient.Builder okHttpClient = new OkHttpClient.Builder();
		okHttpClient.addNetworkInterceptor(new HttpInterceptor());
		okHttpClient.addInterceptor(new LoggingInterceptor.Builder()
				.loggable(EXTERNAL_RELEASE)
				.setLevel(Level.BASIC)
				.log(Platform.INFO)
				.request("Request")
				.response("Response")
//                .addHeader("version", BuildConfig.VERSION_NAME)
				.build());
		okHttpClient.connectTimeout(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
		okHttpClient.readTimeout(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);//等待服务器响应的时间
		okHttpClient.writeTimeout(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
		mRetrofit = new Retrofit.Builder()
				.client(okHttpClient.build())
				.addConverterFactory(GsonConverterFactory.create(buildGson()))//  GsonConverterFactory.create()
				.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
				.baseUrl(BASE_PATH)
				.build();

		mNetService = mRetrofit.create(NetInterface.class);
	}

	private Gson buildGson() {
//        if (gson == null) {
		Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss")
				.registerTypeAdapter(String.class, new StringAdatper())
				.create();
		return gson;
	}


	private class StringAdatper implements JsonSerializer<String>, JsonDeserializer<String> {
		@Override
		public String deserialize(JsonElement json, Type typeOfT,
								  JsonDeserializationContext context)
				throws JsonParseException {
			try {
				if (json.getAsString().equals("")) {
					return "";
				}
			} catch (Exception ignore) {
			}
			try {
				return json.getAsString();
			} catch (NumberFormatException e) {
				throw new JsonSyntaxException(e);
			}
		}

		@Override
		public JsonElement serialize(String src, Type typeOfSrc, JsonSerializationContext context) {
			return new JsonPrimitive(src);
		}
	}

	/**
	 * 类型转换，用来统一处理返回值，通常为公共message返回字段等。具体业务这里要具体操作
	 *
	 * @param <T> Subscriber真正需要的数据类型，也就是返回值针对的model
	 */
	private class HttpResultFunc<T> implements Func1<IModel, T> {
		@Override
		public T call(IModel iModel) {
			if (iModel == null) {
				try {
					throw new Exception("result model is null");
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
			T t = (T) iModel;
			if (t == null) {
				try {
					throw new Exception("cast to the model is null");
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
			return t;
		}
	}


	/**
	 * 组装参数
	 *
	 * @param str
	 * @return
	 */
	private Map<String, String> getParam(String str) {
		Map<String, String> param = new TreeMap<>();
		param.put("data", str);
		param.put("code", "jianshi580");
		param.put("timestamp", System.currentTimeMillis() + "");
		param.put("version", getVersion());
		param.put("platform", "Androidos");//+ Build.MODEL
		param.put("identity", ("CGKnowledgeAndroid-" + getDevieceToken()).replaceAll(":", "-"));//手机唯一标识
		param.put("sign", SignVerifyUtil.sign(param));
		return param;
	}

	public String getDevieceToken() {
		TelephonyManager telephonyManager = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
		String device_token = "";
		try {
			device_token = telephonyManager.getDeviceId();
		} catch (Exception e) {
		}
		if (TextUtils.isEmpty(device_token)) {
			WifiManager wifiManager = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE);
			device_token = wifiManager.getConnectionInfo().getMacAddress();
		}

		if (TextUtils.isEmpty(device_token)) {
			device_token = android.provider.Settings.Secure.getString(mContext.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);
		}

		return device_token;
	}

	/**
	 * 2  * 获取版本号
	 * 3  * @return 当前应用的版本号
	 * 4
	 */
	public String getVersion() {
		try {
			PackageManager manager = mContext.getPackageManager();
			PackageInfo info = manager.getPackageInfo(mContext.getPackageName(), 0);
			String version = info.versionName;
			return version;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return "1.001";
	}


	/**
	 * 下载文件
	 *
	 * @param url
	 */
	public void downloadFile(String url, Func1 function, Subscriber subscriber) {
		mNetService.downloadFile(url).subscribeOn(Schedulers.io())
				.map(function)
				.observeOn(AndroidSchedulers.mainThread())//在Android主线程中展示
				.subscribe(subscriber);
	}


	/**
	 * 初始化观察者
	 *
	 * @param body
	 * @param observable
	 * @param resultType
	 * @param listener
	 */

	private int count = 0;

	private Subscriber initObservable(final JsonObject body, final Observable observable, final int resultType, final ResultSubscriber.OnResultListener listener, final HttpDone httpDone) {
		ResultSubscriber subscriber = new ResultSubscriber(mContext);
		subscriber.setOnResultListener(listener);
		subscriber.setRequestType(resultType);
		observable.filter(new Func1<IModel, Boolean>() {
			@Override
			public Boolean call(IModel t) {
				try {
					int code = t.getErrcode();
					if (code == 100002 || token == null || code == -10000 || code == 100001 || code == 110006) {//说明token过期
//                                uuid = null;
						if (code == 110006) {//非法的uuid
							uuid = null;
						}
						token = null;
						http(body, resultType, listener, httpDone);//重新回调
					} else {
						return true;
					}
//                            return true;
				} catch (Exception e) {
					L.e(e.getMessage() + "initObservable");
				}
				return false;
			}
		})
				.retryWhen(new Func1<Observable<? extends Throwable>, Observable<?>>() {
					@Override
					public Observable<?> call(Observable<? extends Throwable> observable) {
						return observable.flatMap(new Func1<Throwable, Observable<?>>() {
							@Override
							public Observable<?> call(Throwable throwable) {

								if (throwable instanceof IllegalArgumentException || throwable instanceof NullPointerException) {
//                                    String uuid = UUID.randomUUID().toString();
									long timeStamp = System.currentTimeMillis();
									JsonObject obj = new JsonObject();
//                                    obj.addProperty("uuid", uuid);
									obj.addProperty("secuCode", uuid);
									obj.addProperty("timestamp", timeStamp);
									count++;
									if (count > 5) {
										uuid = null;
										count = 0;
									}
									return mNetService.getToken(getParam(obj.toString()))
											.doOnNext(new Action1<IModel>() {
												@Override
												public void call(IModel t) {
													if (t.getErrcode() == 0) {
														JsonObject obj = new JsonParser().parse(t.getData().toString()).getAsJsonObject();
														token = obj.get("token").getAsString();
//                                                        uuid = obj.get("uuid").getAsString();
														uuid = obj.get("secuCode").getAsString();
														count = 0;
														SharedUtil.getInstance(mContext).saveTokenAndUUId(token, uuid);
													} else if (t.getErrcode() == 110006) {//非法的uuid
														uuid = null;
//                                                        count++;
													}
												}
											});

								}
								count++;
								if (count > 3) {
									uuid = null;
									count = 0;
								}

								return Observable.error(throwable);
							}
						});
					}
				}).subscribeOn(Schedulers.io())
				.unsubscribeOn(Schedulers.io())
				.observeOn(AndroidSchedulers.mainThread())
				.subscribe(subscriber);
		return subscriber;
	}


	/**
	 * 请求入口
	 *
	 * @param body
	 */
	private Subscriber http(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener, final HttpDone httpDone) {
		Observable<IModel> subscription = Observable.just(null)
				.flatMap(new Func1<Object, Observable<IModel>>() {
					@Override
					public Observable<IModel> call(Object o) {
						body.addProperty(TOKEN_FILED, token);
						L.d("请求参数===" + body.toString());
						return token == null
								? Observable.<IModel>error(new NullPointerException("Token is null!"))
								: httpDone.done();
					}
				});
		return initObservable(body, subscription, resultType, listener, httpDone);
	}


	private JsonObject addToken(JsonObject obj) {
		obj.addProperty("token", token);
		return obj;
	}


	/**
	 * post获取token
	 *
	 * @param body
	 */
	public Subscriber getToken(final String body, int resultType, ResultSubscriber.OnResultListener listener) {
		Observable<IModel> observable = mNetService.getToken(getParam(body));
		return initObservable(JsonUtil.getInstance().strToJson(body), observable, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.getToken(getParam(body));
			}
		});
	}

	/**
	 * post获取headLine
	 *
	 * @param body
	 */
	public Subscriber getHeadLine(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.getHeadLine(getParam(body.toString()));
			}
		});
	}

	/**
	 * headLine排序
	 *
	 * @param body
	 */
	public Subscriber headLineUpdate(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.headLineUpdate(getParam(body.toString()));
			}
		});
	}

	/**
	 * post获取headLine
	 *
	 * @param body
	 */
	public Subscriber getHeadLineData(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {

		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.getHeadLineData(getParam(body.toString()));
			}
		});
	}

	/**
	 * post获取headLine资讯详情
	 *
	 * @param body
	 */
	public Subscriber getInfoDataDetail(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {

		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.getInfoDataDetail(getParam(body.toString()));
			}
		});
	}

	/**
	 * post关闭推荐详情
	 *
	 * @param body
	 */
	public Subscriber closeHeadContent(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {

		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.headClose(getParam(body.toString()));
			}
		});
	}


	/**
	 * 获取验证码登录
	 *
	 * @param body
	 */
	public Subscriber getSmsCode(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.getSmsCode(getParam(body.toString()));
			}
		});
	}

	/**
	 * 获取组织验证码
	 *
	 * @param body
	 */
	public Subscriber getOrganizaSmsCode(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.getOrganizaSmsCode(getParam(body.toString()));
			}
		});
	}

	/**
	 * 获取验语言验证码
	 *
	 * @param body
	 */
	public Subscriber getVoiceCode(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.getVoiceCode(getParam(body.toString()));
			}
		});
	}

	/**
	 * 执行登录
	 *
	 * @param body
	 */
	public Subscriber login(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.login(getParam(body.toString()));
			}
		});
	}

	/**
	 * 头条收藏接口
	 *
	 * @param body
	 */
	public Subscriber collectionHead(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.collectionHead(getParam(body.toString()));
			}
		});
	}

	/**
	 * 头条取消收藏接口
	 *
	 * @param body
	 */
	public Subscriber cancleCollectionHead(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.cancleCollectionHead(getParam(body.toString()));
			}
		});
	}

	/**
	 * 获取资讯话题列表
	 *
	 * @param body
	 */
	public Subscriber headlinesTopicList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.headlinesTopicList(getParam(body.toString()));
			}
		});
	}

	/**
	 * 资讯详情状态
	 *
	 * @param body
	 */
	public Subscriber headlinesInfoDetailState(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.headlinesInfoDetailState(getParam(body.toString()));
			}
		});
	}

	/**
	 * 开启话题
	 *
	 * @param body
	 */
	public Subscriber addTopic(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.addTopic(getParam(body.toString()));
			}
		});
	}

	/**
	 * 发表评论
	 *
	 * @param body
	 */
	public Subscriber addComment(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.addComment(getParam(body.toString()));
			}
		});
	}

	/**
	 * 发表评论回复
	 *
	 * @param body
	 */
	public Subscriber replyTopic(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.replyTopic(getParam(body.toString()));
			}
		});
	}

	/**
	 * 评论回复列表
	 *
	 * @param body
	 */
	public Subscriber replyList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.replyList(getParam(body.toString()));
			}
		});
	}

	/**
	 * 话题点赞
	 *
	 * @param body
	 */
	public Subscriber topicPraise(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.topicPraise(getParam(body.toString()));
			}
		});
	}

	/**
	 * 获取话题其他列表
	 *
	 * @param body
	 */
	public Subscriber topicOtherList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.topicOtherList(getParam(body.toString()));
			}
		});
	}

	/**
	 * 获取话题标签
	 *
	 * @param body
	 */
	public Subscriber topicTags(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.topicTags(getParam(body.toString()));
			}
		});
	}


	/**
	 * 关注主题列表
	 *
	 * @param body
	 */
	public Subscriber subscribeThemeList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.subscribeThemeList(getParam(body.toString()));
			}
		});
	}

	/**
	 * 关注产品列表
	 *
	 * @param body
	 */
	public Subscriber subscribeproductList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.subscribeproductList(getParam(body.toString()));
			}
		});
	}

	/**
	 * 关注公司列表
	 *
	 * @param body
	 */
	public Subscriber subscribecompanyList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.subscribecompanyList(getParam(body.toString()));
			}
		});
	}

	/**
	 * 关注人物列表
	 *
	 * @param body
	 */
	public Subscriber subscribefigureList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.subscribefigureList(getParam(body.toString()));
			}
		});
	}

	/**
	 * 关注频道列表
	 *
	 * @param body
	 */
	public Subscriber subscribechannelList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.subscribechannelList(getParam(body.toString()));
			}
		});
	}

	/**
	 * 关注列表头部详情信息
	 *
	 * @param body
	 */
	public Subscriber subscribeInfo(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.subscribeInfo(getParam(body.toString()));
			}
		});
	}

	/**
	 * 关注列表头部导航
	 *
	 * @param body
	 */
	public Subscriber subscribeNavList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.subscribeNavList(getParam(body.toString()));
			}
		});
	}

	/**
	 * 关注列表头部导航
	 *
	 * @param body
	 */
	public Subscriber userDetail(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.userDetail(getParam(body.toString()));
			}
		});
	}

	/**
	 * 关注详情列表
	 *
	 * @param body
	 */
	public Subscriber subscribeDetailsList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.subscribeDetailsList(getParam(body.toString()));
			}
		});
	}

	/**
	 * 体验banna接口
	 *
	 * @param body
	 */
	public Subscriber discoverExpBanner(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.discoverExpBanner(getParam(body.toString()));
			}
		});
	}

	/**
	 * 体验首页数据接口
	 *
	 * @param body
	 */
	public Subscriber discoverExpData(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.discoverExpData(getParam(body.toString()));
			}
		});
	}

	/**
	 * 话题未评论可删除列表
	 *
	 * @param body
	 */
	public Subscriber topicDelete(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.topicDelete(getParam(body.toString()));
			}
		});
	}

	/**
	 * 评论删除
	 *
	 * @param body
	 */
	public Subscriber commentDelete(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.commentDelete(getParam(body.toString()));
			}
		});
	}

	/**
	 * 发现首页基础数据
	 *
	 * @param body
	 */
	public Subscriber discoverData(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.discoverData(getParam(body.toString()));
			}
		});
	}


	/**
	 * 发现首页app列表接口
	 *
	 * @param body
	 */
	public Subscriber discoverApps(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.discoverApps(getParam(body.toString()));
			}
		});
	}


	/**
	 * 全局搜索
	 *
	 * @param body
	 */
	public Subscriber commonSearch(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.commonSearch(getParam(body.toString()));
			}
		});
	}

	/**
	 * 知识搜索
	 *
	 * @param body
	 */
	public Subscriber knowlageSearch(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.knowlageSearch(getParam(body.toString()));
			}
		});
	}

	/**
	 * 获取话题数据
	 *
	 * @param body
	 */
	public Subscriber headlinesTopicDetails(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.headlinesTopicDetails(getParam(body.toString()));
			}
		});
	}


	/**
	 * 全局关键字搜索
	 *
	 * @param body
	 */
	public Subscriber jpSearch(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.jpSearch(getParam(body.toString()));
			}
		});
	}


	/**
	 * 标签分类列表接口
	 *
	 * @param body
	 */
	public Subscriber commonTagsList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.commonTagsList(getParam(body.toString()));
			}
		});
	}


	/**
	 * 获取上传图片token
	 *
	 * @param body
	 */
	public Subscriber getuploadToken(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.getuploadToken(getParam(body.toString()));
			}
		});
	}


	/**
	 * 修改用户信息
	 *
	 * @param body
	 */
	public Subscriber updateUserInfo(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.updateUserInfo(getParam(body.toString()));
			}
		});
	}


	/**
	 * 修改用户信息
	 *
	 * @param body
	 */
	public Subscriber updateSkillLevel(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.updateSkillLevel(getParam(body.toString()));
			}
		});
	}

	/* 搜索组织 */
	public Subscriber searchOrganize(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.searchOrganize(getParam(body.toString()));
			}
		});
	}

	/* 获取部门 */
	public Subscriber getDepartment(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.getDepartment(getParam(body.toString()));
			}
		});
	}

	/* 获取班级 */
	public Subscriber getClass(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.getClass(getParam(body.toString()));
			}
		});
	}

	/* 提交加入组织 */
	public Subscriber commitJoinOrganize(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.commitJoinOrganize(getParam(body.toString()));
			}
		});
	}

	/* 组织创建部门 */
	public Subscriber createDepartment(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.createDepartment(getParam(body.toString()));
			}
		});
	}

	/* 部门重命名 */
	public Subscriber renameDepartment(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.renameDepartment(getParam(body.toString()));
			}
		});
	}

	/* 删除部门 */
	public Subscriber deleteDepartment(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.deleteDepartment(getParam(body.toString()));
			}
		});
	}

	/* 学校创建部门 */
	public Subscriber createClass(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.createClass(getParam(body.toString()));
			}
		});
	}

	/**
	 * 我的体验
	 *
	 * @param body
	 */
	public Subscriber myExperience(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.myExperience(getParam(body.toString()));
			}
		});
	}


	/**
	 * 我的体验排序
	 *
	 * @param body
	 */
	public Subscriber expMySort(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.expMySort(getParam(body.toString()));
			}
		});
	}


	/**
	 * 我的体验创建组
	 *
	 * @param body
	 */
	public Subscriber expAddGroup(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.expAddGroup(getParam(body.toString()));
			}
		});
	}


	/**
	 * 我的体验加入组
	 *
	 * @param body
	 */
	public Subscriber expMyGroupAdd(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.expMyGroupAdd(getParam(body.toString()));
			}
		});
	}


	/**
	 * 我的体验最近体验
	 *
	 * @param body
	 */
	public Subscriber expMyLately(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.expMyLately(getParam(body.toString()));
			}
		});
	}


	/**
	 * 获取团队圈数据
	 */
	public Subscriber getTeamCircle(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.getTeamCircle(getParam(body.toString()));
			}
		});
	}

	/**
	 * 获取团队点赞
	 */
	public Subscriber teamCirclePraise(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.teamCirclePraise(getParam(body.toString()));
			}
		});
	}

	/* 团队圈评论 */
	public Subscriber teamCircleComment(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.teamCircleComment(getParam(body.toString()));
			}
		});
	}

	/* 团队圈删除 */
	public Subscriber teamCircleDelete(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.teamCircleDelete(getParam(body.toString()));
			}
		});
	}

	/* 团队圈获取联系人列表*/
	public Subscriber teamCircleConstacts(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.teamCircleConstacts(getParam(body.toString()));
			}
		});
	}

	/**
	 * 团队圈发表动态
	 *
	 * @param body
	 */
	public Subscriber teamCirclePushDynamic(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.teamCirclePushDynamic(getParam(body.toString()));
			}
		});
	}

	/**
	 * 获取用户的所有组织
	 *
	 * @param body
	 */
	public Subscriber getAllOrganiza(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.getAllOrganiza(getParam(body.toString()));
			}
		});
	}

	/**
	 * 切换用户当前组织
	 *
	 * @param body
	 */
	public Subscriber switchOrganiza(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.switchOrganiza(getParam(body.toString()));
			}
		});
	}

	/**
	 * 用户退出组织
	 *
	 * @param body
	 */
	public Subscriber exitOrganiza(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.exitOrganiza(getParam(body.toString()));
			}
		});
	}

	/**
	 * 获取行业分类
	 *
	 * @param body
	 */
	public Subscriber getIndustryList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.getIndustryList(getParam(body.toString()));
			}
		});
	}

	/**
	 * 创建公司
	 *
	 * @param body
	 */
	public Subscriber companyCreate(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.companyCreate(getParam(body.toString()));
			}
		});
	}


	/**
	 * 行业分类接口列表
	 */
	public Subscriber commonIndustryList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.commonIndustryList(getParam(body.toString()));
			}
		});
	}


	/**
	 * 获取收藏
	 *
	 * @param body
	 */
	public Subscriber getCollection(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.getCollection(getParam(body.toString()));
			}
		});
	}


	/**
	 * 取消收藏
	 *
	 * @param body
	 */
	public Subscriber unCollection(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.unCollection(getParam(body.toString()));
			}
		});
	}

	/**
	 * 我的体验删除
	 */
	public Subscriber expMyDelete(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.expMyDelete(getParam(body.toString()));
			}
		});
	}


	/**
	 * 我的体验删除
	 */
	public Subscriber expMyGroupRename(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.expMyGroupRename(getParam(body.toString()));
			}
		});
	}


	/**
	 * 关注/取消关注 操作
	 *
	 * @param body
	 */
	public Subscriber subscribeOperate(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.subscribeOperate(getParam(body.toString()));
			}
		});
	}

	/**
	 * 组织认证
	 *
	 * @param body
	 */
	public Subscriber authOrganize(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.authOrganize(getParam(body.toString()));
			}
		});
	}

	/**
	 * 通讯录上传匹配
	 *
	 * @param body
	 */
	public Subscriber phonebook(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.phonebook(getParam(body.toString()));
			}
		});
	}

	/**
	 * 邀请同事
	 *
	 * @param body
	 */
	public Subscriber invitation(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.invitation(getParam(body.toString()));
			}
		});
	}

	/**
	 * 团队通讯录
	 *
	 * @param body
	 */
	public Subscriber companyAddressBook(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.companyAddressBook(getParam(body.toString()));
			}
		});
	}

	/**
	 * 设置组织普通管理员
	 *
	 * @param body
	 */
	public Subscriber setCompanyManager(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.setCompanyManager(getParam(body.toString()));
			}
		});
	}

	/**
	 * 转让超级管理员
	 *
	 * @param body
	 */
	public Subscriber transferSuperManager(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.transferSuperManager(getParam(body.toString()));
			}
		});
	}

	/**
	 * 使用户强制退出组织
	 *
	 * @param body
	 */
	public Subscriber removeUserFromCompany(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.removeUserFromCompany(getParam(body.toString()));
			}
		});
	}

	/**
	 * 获取同事审核列表
	 *
	 * @param body
	 */
	public Subscriber getAuditList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.getAuditList(getParam(body.toString()));
			}
		});
	}

	/**
	 * 提交同事审核
	 *
	 * @param body
	 */
	public Subscriber commitAudit(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.commitAudit(getParam(body.toString()));
			}
		});
	}

	/**
	 * 校正分类
	 */
	public Subscriber correctingNavType(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.correctingNavType(getParam(body.toString()));
			}
		});
	}


	/**
	 * 绑定微信
	 */
	public Subscriber bindWeiChat(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.bindWeiChat(getParam(body.toString()));
			}
		});
	}


	/**
	 * 搜索中 recommendAction == josinExp
	 */
	public Subscriber joinExp(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.joinExp(getParam(body.toString()));
			}
		});
	}

	/**
	 * 搜索中 recommendAction == joinRecommend
	 */
	public Subscriber joinRecommend(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.joinRecommend(getParam(body.toString()));
			}
		});
	}

	/**
	 * 搜索中 recommendAction == joinRecommend
	 */
	public Subscriber unJoinRecommend(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.unJoinRecommend(getParam(body.toString()));
			}
		});
	}

	/**
	 * 搜索中 recommendAction == joinSubject
	 */
	public Subscriber joinSubject(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.joinSubject(getParam(body.toString()));
			}
		});
	}

	/**
	 * 检查 H5 版本
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber checkH5Version(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.checkH5Version(getParam(body.toString()));
			}
		});
	}

	/**
	 * 微信打赏
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber wechatPay(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.wechatPay(getParam(body.toString()));
			}
		});
	}

	/**
	 * 头条详情行业分析
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber getBigdata(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.getBigdata(getParam(body.toString()));
			}
		});
	}

	/**
	 * 首页热搜关键字
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber hotSearch(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.hotSearch(getParam(body.toString()));
			}
		});
	}

	/**
	 * 雷达关注组
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber attentionGroup(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.attentionGroup(getParam(body.toString()));
			}
		});
	}

	/**
	 * 雷达关注列表
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber attentionList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.attentionList(getParam(body.toString()));
			}
		});
	}

	/**
	 * 雷达分组列表接口
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber attentionGroupList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.attentionGroupList(getParam(body.toString()));
			}
		});
	}

	/**
	 * 雷达分组创建
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber attentionGroupCreate(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.attentionGroupCreate(getParam(body.toString()));
			}
		});
	}

	/**
	 * 雷达分组删除
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber attentionGroupDelete(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.attentionGroupDelete(getParam(body.toString()));
			}
		});
	}

	/**
	 * 雷达分组重命名
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber attentionGroupRename(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.attentionGroupRename(getParam(body.toString()));
			}
		});
	}

	/**
	 * 雷达分组资讯列表详情
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber attentionGroupDetailList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.attentionGroupDetailList(getParam(body.toString()));
			}
		});
	}

	/**
	 * 雷达详情统计接口
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber attentionGroupStatistics(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.attentionGroupStatistics(getParam(body.toString()));
			}
		});
	}

	/**
	 * 雷达分组名单列表
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber attentionGroupListOfName(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.attentionGroupListOfName(getParam(body.toString()));
			}
		});
	}

	/**
	 * 获取钱包基础信息
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber walletInfo(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.walletInfo(getParam(body.toString()));
			}
		});
	}


	/**
	 * 获取钱包使用记录列表
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber walletList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.walletList(getParam(body.toString()));
			}
		});
	}

	/**
	 * 提现到微信红包
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber withDrawAmount(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.withDrawAmount(getParam(body.toString()));
			}
		});
	}


	/**
	 * 更新组织信息
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber updateOrganize(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.updateOrganize(getParam(body.toString()));
			}
		});
	}


	/**
	 * 雷达列表置顶
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber attentionStickTop(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.attentionStickTop(getParam(body.toString()));
			}
		});
	}


	/**
	 * 获取监控组数据
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber attentionGroupData(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.attentionGroupData(getParam(body.toString()));
			}
		});
	}

	/**
	 * 雷达分组名单编辑
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber attentionGroupConditionAdd(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.attentionGroupConditionAdd(getParam(body.toString()));
			}
		});
	}

	/**
	 * 公司排序
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber sortOrganize(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.sortOrganize(getParam(body.toString()));
			}
		});
	}

	/**
	 * 技能导航分类
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber getSkill(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.getSkill(getParam(body.toString()));
			}
		});
	}

	/**
	 * 技能详情
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber skillDetail(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.skillDetail(getParam(body.toString()));
			}
		});
	}

	/**
	 * 岗位工具列表详情
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber toolList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.toolList(getParam(body.toString()));
			}
		});
	}

	/**
	 * 获取订单列表
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber getOrderList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.getOrderList(getParam(body.toString()));
			}
		});
	}

	/**
	 * 订单取消
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber orderCancel(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.orderCancel(getParam(body.toString()));
			}
		});
	}

	/**
	 * 确认收货
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber orderReceipt(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.orderReceipt(getParam(body.toString()));
			}
		});
	}

	/**
	 * 获取订单进度列表
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber getOrderScheduleList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.getOrderScheduleList(getParam(body.toString()));
			}
		});
	}

	/**
	 * 用户积分历史
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber integralHistory(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.integralHistory(getParam(body.toString()));
			}
		});
	}

	/**
	 * 用户特权数据
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber userPrivilege(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.userPrivilege(getParam(body.toString()));
			}
		});
	}

	/**
	 * 我的点评
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber myComments(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.myComments(getParam(body.toString()));
			}
		});
	}

	/**
	 * 意见反馈列表
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber feedbackList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.feedbackList(getParam(body.toString()));
			}
		});
	}

	/**
	 * 意见反馈删除
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber feedbackDelete(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.feedbackDelete(getParam(body.toString()));
			}
		});
	}

	/**
	 * 意见反馈评论
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber feedbackComment(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.feedbackComment(getParam(body.toString()));
			}
		});
	}

	/**
	 * 意见反馈发表
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber feedbackPush(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.feedbackPush(getParam(body.toString()));
			}
		});
	}

	/**
	 * 消息推送列表
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber messageList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.messageList(getParam(body.toString()));
			}
		});
	}

	/**
	 * 系统消息列表
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber messageSystemList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.messageDetailList(getParam(body.toString()));
			}
		});
	}

	/**
	 * 产品评测
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber productEvluationList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.productEvluationList(getParam(body.toString()));
			}
		});
	}

	/**
	 * 全民推荐列表
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber recommendList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.recommendList(getParam(body.toString()));
			}
		});
	}

	/**
	 * 界面标签目录
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber catalogTree(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.catalogTree(getParam(body.toString()));
			}
		});
	}

	/**
	 * 界面首页数据
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber discoverInterfaceList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.discoverInterfaceList(getParam(body.toString()));
			}
		});
	}

	/**
	 * 获取vip套餐数据接口
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber gradesPackage(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.gradesPackage(getParam(body.toString()));
			}
		});
	}

	/**
	 * 获取vip支付方式
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber getPayWay(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.getPayWay(getParam(body.toString()));
			}
		});
	}

	/**
	 * 获取知识餐列表接口
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber knowledgeList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.knowledgeList(getParam(body.toString()));
			}
		});
	}

	/**
	 * 获取知识目录
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber knowledgePackage(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.knowledgePackage(getParam(body.toString()));
			}
		});
	}

	/**
	 * 体验库列表
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber expList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.expList(getParam(body.toString()));
			}
		});
	}

	/**
	 * 产品平台记录列表
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber productPlatformList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.productPlatformList(getParam(body.toString()));
			}
		});
	}

	/**
	 * 产品版本记录列表
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber productVersionList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.productVersionList(getParam(body.toString()));
			}
		});
	}

	/**
	 * 用户套餐列表
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber packageList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.packageList(getParam(body.toString()));
			}
		});
	}

	/**
	 * 团队圈积分打赏
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber rewardIntegral(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.rewardIntegral(getParam(body.toString()));
			}
		});
	}

	/**
	 * VIP等级列表
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber vipList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.vipList(getParam(body.toString()));
			}
		});
	}

	/**
	 * 获取VIP信息
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber getVipInfo(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.getVipInfo(getParam(body.toString()));
			}
		});
	}

	/**
	 * 帮助栏目
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber helpCate(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.helpCate(getParam(body.toString()));
			}
		});
	}

	/**
	 * 帮助栏目列表
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber helpCateList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.helpCateList(getParam(body.toString()));
			}
		});
	}

	/**
	 * 帮助信息页面接
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber userHelpCatePage(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.userHelpCatePage(getParam(body.toString()));
			}
		});
	}

	/**
	 * 技能导航分类
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber skillNavList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.skillNavList(getParam(body.toString()));
			}
		});
	}

	/**
	 * 详情积分购买报告
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber integralPurchase(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.integralPurchase(getParam(body.toString()));
			}
		});
	}

	/**
	 * 用户邀请好友数据接口
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber inviteFriends(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.inviteFriends(getParam(body.toString()));
			}
		});
	}

	/**
	 * 知识专辑列表
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber discoverPackageList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.discoverPackageList(getParam(body.toString()));
			}
		});
	}

	/**
	 * 重新绑定电话号码
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber changePhone(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.changePhone(getParam(body.toString()));
			}
		});
	}

	/**
	 * 团队圈互动消息数据
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber interactData(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.interactData(getParam(body.toString()));
			}
		});
	}

	/**
	 * 团队圈互动消息列表
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber interactList(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.interactList(getParam(body.toString()));
			}
		});
	}

	/**
	 * 团队圈报料详情接口
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber scoopDetailsData(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.scoopDetailsData(getParam(body.toString()));
			}
		});
	}

	/**
	 * 知识餐套餐目录列表
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber knowledgePackageIndex(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.knowledgePackageIndex(getParam(body.toString()));
			}
		});
	}

	/**
	 * 头条详情校正管理
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber headlinesUpdateByAdmin(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.headlinesUpdateByAdmin(getParam(body.toString()));
			}
		});
	}

	/**
	 * 界面详情校正管理
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber interfaceUpdateByAdmin(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.interfaceUpdateByAdmin(getParam(body.toString()));
			}
		});
	}

	/**
	 * 采集校正
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber spider(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.spider(getParam(body.toString()));
			}
		});
	}

	/**
	 * 组织信息获取
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber organizaInfo(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.organizaInfo(getParam(body.toString()));
			}
		});
	}

	/**
	 * 组织信息编辑
	 *
	 * @param body
	 * @param resultType
	 * @param listener
	 * @return
	 */
	public Subscriber organizaEdit(final JsonObject body, int resultType, ResultSubscriber.OnResultListener listener) {
		return http(body, resultType, listener, new HttpDone() {
			@Override
			public Observable<IModel> done() {
				return mNetService.organizaEdit(getParam(body.toString()));
			}
		});
	}

	private interface HttpDone {
		Observable<IModel> done();
	}
}
